import React from 'react';
import { Meta, Story } from '@storybook/react';
import { AutoComplete, AutoCompleteType } from '../src';

const meta: Meta  = {
  title: 'AutoComplete',
  component: AutoComplete,
  argTypes: {},
  parameters: {
    controls: { expanded: true },
  },
};

export default meta;

const Template: Story<AutoCompleteType> = args => {
  return <AutoComplete {...args} />;
}

// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
// https://storybook.js.org/docs/react/workflows/unit-testing
export const Default = Template.bind({});

Default.args = {
  renderFilter:(query:string)=>{
    const data=['yehuozhili','bigbear','nike','hello kitty','shop','eat','pikaqiu','gobigger','dell'];
    return data.filter(name=>name.includes(query)).map(v=>({value:v}))
  }
};
